<?php
class TRF_Controller_Plugin_Layout extends Zend_Controller_Plugin_Abstract
{
	public function dispatchLoopStartup( Zend_Controller_Request_Abstract $request )
	{
		$layout = Zend_Layout::getMvcInstance();
		$layout->setLayoutPath( APPLICATION_PATH . "/layouts/scripts" );

		// указываем путь к layout'ам
		$module = $request->getModuleName();

		if ( in_array( $module, array( 'default', 'admin' ) ) )
		{
			$layout->setLayout( $module );
		}
		else
		{
			$layout->setLayout( 'default' );
		}
	}
}
